package Sequence;

public class Test0746 {
}

class Solution0746_1 {
    public int minCostClimbingStairs(int[] cost) {
        int pre1 = cost[0],pre2 = cost[1];

        for (int i = 2; i < cost.length; i++) {
            int now = cost[i];
            int temp = Math.min(pre1, pre2);
            pre1 = pre2;
            pre2= temp +now;

        }

        return Math.min(pre1,pre2);
    }
}
